import Vue from 'vue'
import Vuex from 'vuex'
// import axios from 'axios'
// import Axios from '../assets/js/api'

Vue.use(Vuex)

const state = {
  appKey: '',
  taoKey: '',
  mpOpenId: '',
  picUrl: ''
};

const getters = {
  appKey: state => state.appKey,
  taoKey: state => state.taoKey,
  mpOpenId: state => state.mpOpenId,
  picUrl: state => state.picUrl
};

const mutations =  {
  setAppKey (state, appKey) {
    state.appKey = appKey
  },
  SET_TAOKEY(state, payload){
    state.taoKey = payload
  },
  SET_MPOPENID (state, openId) {
    state.mpOpenId = openId
  },
  SET_PICURL (state, picurl) {
    state.picUrl = picurl
  }
};

const actions = {
  setTaoKey({commit}, taoKey){
    commit('SET_TAOKEY', taoKey)
  }
};

const store = new Vuex.Store({
  state,
  getters,
  mutations,
  actions
});

export default store;
